//
//  WZC_SearchView.swift
//  XMYouPin
//
//  Created by 王宗成 on 2019/7/2.
//  Copyright © 2019 王宗成. All rights reserved.
//

import UIKit
import SnapKit
class WZC_SearchView: UIView {

    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    lazy var leftBtn: UIButton = {
        
        let icon : UIButton = UIButton(type: .custom)
        self.addSubview(icon)
        return icon
    }()
    
    lazy var rightBtn: UIButton = {
        
        let icon : UIButton = UIButton(type: .custom)
        self.addSubview(icon)
        return icon
    }()
    
    lazy var textFiled: UITextField = {
        
        let textUI : UITextField = UITextField()
        textUI.font = Font(15)
        self.addSubview(textUI)
        return textUI
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        layoutSubViewUI()
    }
    
    func layoutSubViewUI() -> Void {
        
        self.backgroundColor = RGB(r: 247, g: 243, b: 248)
        self.leftBtn.setImage(IMAGE("mjyp_navi_search"), for: .normal)
        self.rightBtn.setImage(IMAGE("mjyp_navi_main_page_scan"), for: .normal)
        self.textFiled.placeholder = "搜一搜"
        self.layer.cornerRadius = 5;
  
        self.leftBtn.snp.makeConstraints { (make) in
            
            make.left.equalTo(5)
            make.centerY.equalToSuperview()
        }
        
        self.rightBtn.snp.makeConstraints { (make) in
            
            make.right.equalTo(-5)
            make.centerY.equalToSuperview()
        }
        
        self.textFiled.snp.makeConstraints { (make) in
            
            make.left.equalTo(30)
            make.top.bottom.equalToSuperview()
            make.right.equalTo(-30)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
